<?php include(FULL_HTML_VIEWS_PATH . '/common/page_header.php'); ?>
<link href="css/amap.Default.css" rel="stylesheet">
<?php if (isset($debug_page) && $debug_page === TRUE): ?>
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/main.css" rel="stylesheet">
<?php endif; ?>
<div class="page_loading" style="display: none;"></div>
<?php include(FULL_HTML_VIEWS_PATH . '/common/page_menu.php'); ?>

<div class="main-content">
    <div class="main-content-inner">
        <div class="page-content">

            <div class="row">
                <div class="col-sm-12">
                    <div class="breadcrumbs" id="breadcrumbs">
                        <ul class="breadcrumb">
                            <?php include(FULL_HTML_VIEWS_PATH . '/common/page_ur_here.php'); ?>
                        </ul>
                    </div>
                </div>
            </div>
            <h2 class="sub-header">
                <?php echo $page_title; ?>
            </h2>
            <div class="row">
                <div class="col-sm-12">
                    <!-- Nav tabs -->
                    <ul class="nav nav-tabs" role="tablist" style="margin:0px 5px;">
                        <li class="active"><a href="#base" role="tab" data-toggle="tab">基本信息</a></li>
                    </ul>
                    <div class="panel panel-default" style="margin-top:-2px;">
                        <div class="panel-heading hide" style=" margin:0px 1px;">
                            <span class="glyphicon glyphicon-list"></span> &nbsp;&nbsp;id - title
                        </div><!--panel-heading-->
                        <div class="panel-body tab-content">
                            <div id="base" class="tab-pane active">
                                <form data-action="ajaxPageForm" action="<?php echo site_url("$my_router/post") ?>" class="form-horizontal" role='form' method="post" autocomplete="off">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">编号</label>
                                        <div class="col-sm-2">
                                            <input class="form-control" type="text" value="<?php if (isset($info['id'])) echo $info['id']; ?>" name="" disabled/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">用户头像</label>
                                        <div class="row">
                                            <div class="col-sm-8 col-md-1">
                                                <a id="hu_img_a" href="<?php echo get_image_oss($info['avatar']); ?>" rel='highslide' class="thumbnail" style="margin-bottom:0px;">
                                                    <img id="hu_img_img" alt="用户头像" onerror="this.src='<?php echo full_static_url('res/no_picture.png'); ?>'" src="<?php echo get_image_oss($info['avatar']); ?>"/>
                                                </a></div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <input type="hidden" name="file_id" id="file_id" value="0">
                                        <input type="hidden" id="file_is_up" name="file_is_up" value="n">

                                        <label class="control-label col-sm-2"></label>
                                        <div class="col-sm-2">
                                            <input data-button-text="选择图片" type="file" id="uploader-model_icon-input" data-modal="uploadify3" file-action="" data-action="file/uploader/hospital_user" value="" size="5" data-post='{"itemid":0,"sessid":"<?php echo session_id(); ?>"}'/>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">手机号</label>
                                        <div class="col-sm-2">
                                            <input class="form-control" type="text" data-demand="required" value="<?php if (isset($info['mobile'])) echo $info['mobile'] ?>" name="mobile"/>
                                        </div>
                                    </div>
                                    <?php if ($info['id'] == 0): ?>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">系统默认密码为</label>
                                            <div class="col-sm-2" style="margin-top: 10px;">
                                                <span>123456</span>
                                            </div>
                                        </div>
                                    <?php endif; ?>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">真实姓名</label>
                                        <div class="col-sm-2">
                                            <input class="form-control" data-demand="required" type="text" value="<?php if (isset($info['real_name'])) echo $info['real_name'] ?>" name="real_name"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">性别</label>
                                        <div class="col-sm-2">

                                            <select name="gender" id="gender" class="form-control">
                                                <option value="0" <?php echo $info['gender'] == 0 ? "selected" : "" ?>>保密</option>
                                                <option value="1" <?php echo $info['gender'] == 1 ? "selected" : "" ?>>男</option>
                                                <option value="2" <?php echo $info['gender'] == 2 ? "selected" : "" ?>>女</option>
                                            </select>

                                        </div>
                                    </div>
                                    <!--<div class="form-group">
                                        <label class="control-label col-sm-2">所属角色</label>
                                        <div class="col-sm-2">
                                            <select name="web_role_id" class="form-control" data-demand="">
                                                <option value="">请选择角色</option>
                                                <?php /*foreach ($role_list as $k => $v): */?>
                                                    <option value="<?php /*echo $v['id']; */?>" <?php /*echo $info['web_role_id'] == $v['id'] ? "selected" : "" */?>><?php /*echo $v['role_name']; */?></option>
                                                <?php /*endforeach; */?>
                                            </select>
                                        </div>
                                    </div>-->

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">所属角色</label>
                                        <div class="col-sm-6">
                                            <?php $web_role_id_arr = explode(',', $info['web_role_id']); foreach ($role_list as $k => $v): ?>
                                                <label class="checkbox-inline">
                                                    <input <?php echo in_array($v['id'], $web_role_id_arr) ?  'checked' : '';?> type="checkbox" name="web_role_id[]" value="<?php echo $v['id']; ?>"> <?php echo $v['role_name']; ?>
                                                </label>
                                            <?php endforeach; ?>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">添加时间</label>
                                        <div class="col-sm-2">
                                            <input class="form-control" type="text" value="<?php if (isset($info['add_time'])) echo date("Y-m-d H:i:s", $info['add_time']) ?>" disabled/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">最后登录时间</label>
                                        <div class="col-sm-2">
                                            <input class="form-control" type="text" value="<?php if (isset($info['last_time'])) echo date("Y-m-d H:i:s", $info['last_time']) ?>" disabled/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label" for="">用户状态</label>
                                        <span class="btn-group col-sm-5">
                                        <label class="checkbox-inline" style="padding-left:0px">
                                            <input name="active" type="radio" autocomplete="off" <?php echo $info['active'] == 1 ? 'checked="checked"' : "" ?> value="1"> 启用
                                        </label>
                                        <label class="checkbox-inline">
                                            <input name="active" type="radio" autocomplete="off" <?php echo $info['active'] == 0 ? 'checked="checked"' : "" ?> value="0"> 禁用
                                        </label>
                                        </span>
                                    </div>

                                    <div class="form-group">
                                        <label id="" class="col-sm-2 control-label sr-only"></label>
                                        <div class="col-sm-3 compact_form">
                                            &nbsp;&nbsp;&nbsp;
                                            <button id="adddepartment" type="submit" class="btn btn-lg btn-primary disabled1" data-loading-text="Loading..." autocomplete="off">
                                                <span class="glyphicon glyphicon-save"></span>&nbsp;保存
                                            </button>
                                            <input type="hidden" name="action" id="action" value="<?php echo $form_action; ?>">
                                            <input type="hidden" name="id" id="id" value="<?php echo $info['id'] ?>">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <!--#base.tab-pane-->


                        </div><!--panel-body-->


                    </div><!--panel-->
                </div><!--col-sm-12-->
                <!--debug-->
                <div class="col-sm-12 help-block" id="targetUrl"></div>
            </div><!--row-->

        </div>
    </div><!--main row-->
    <div class="center-block" style="height:30px;"></div>

</div>

<?php include(FULL_HTML_VIEWS_PATH . '/common/page_script.html'); ?>

<script type="text/javascript">
    uploaderResponseInPage();
    function uploaderResponseInPage() {
        Ucenter.creatUploadify(
            $('[data-modal="uploadify3"]'),
            null,
            function (res, file, datas) {
                if (res.error > 0) {
                    Ucenter.alert(res);
                } else {
                    if (typeof(res.file_id) == 'undefined') {
                        $("#uploader-" + res.action + "-img").attr('src', res.format_thumb);
                        $("#uploader-" + res.action + "-link").attr('href', res.format_image);
                    } else {
                        //	$("#tmpFileList").append($("#tmpFileList .imgLi:last").clone());
                        //	$("#tmpFileList #imgLi:last").attr('data-id', res.file_id);
                        $('#file_id').val(res.file_id);

                        //地址
                        $("#hu_img_a").attr('href', res.format_image);
                        $("#hu_img_img").attr('src', res.format_thumb);
                        $('#file_is_up').val('y');
                    }

                }
            }
        );
    }

</script>

<?php include(FULL_HTML_VIEWS_PATH . '/common/page_footer.php'); ?>
